package com.oracle.entity;

import com.oracle.pojo.Teacher;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;


//补充的工具类,为passwordEncoder提供服务
public class LoginTeacher implements UserDetails {


    private Teacher teacher;

    public LoginTeacher() {
    }

    public LoginTeacher(Teacher teacher) {
        this.teacher = teacher;
    }


    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return teacher.getTeachPwd();
    }

    @Override
    public String getUsername() {
        return teacher.getTeachNum();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
